package com.lyx.fileio;

import java.io.*;

public class TestCopy02 {
    public static void main(String[] args) throws IOException {
        File file = new File("c:\\readme.txt");

        InputStream inputStream = new FileInputStream(file);
        OutputStream outputStream = new FileOutputStream("c:\\reademe2.txt");
//        int n;
//        n = inputStream.read();
        byte[] a = new byte[1024];
        int len = inputStream.read(a);
        while (len != -1){
//            outputStream.write(n);
//            n = inputStream.read();
            outputStream.write(a,0,len);
            len = inputStream.read(a);
        }
        inputStream.close();
        outputStream.close();
    }
}
